
#include <pic.h>
#include "eeprom.h"

extern unsigned char BankNoteNominal;

#define   PERIOD_10ms 	156

bit Time_10ms;
bit Time_1000ms;



volatile bit iTime_10ms;

void interrupt handler ( void )
{
	if ( INTF )
	{
		EEPROM_WRITE(E2_ADDR_COUNTER, BankNoteNominal);
		for(;;);
	}

	if ( T0IF )
	{
		TMR0 -= PERIOD_10ms;
		iTime_10ms = 1;
		T0IF = 0;
	}

}


unsigned char Div_100 = 100;
unsigned char Div_5 = 5;

void SysTime( void )
{
 	Time_10ms = 0;
 	Time_1000ms = 0;
// 	Time_5000ms = 0;

	if ( iTime_10ms )
	{
		iTime_10ms = 0;
		
		Time_10ms = 1;
		
		if ( --Div_100 == 0 )
		{
			Div_100 = 100;
			Time_1000ms = 1;
			
/* 			if ( --Div_5 == 0 ) */
/* 			{ */
/* 				Div_5 = 5; */
/* 				Time_5000ms = TRUE; */
/* 			} */
		}
	}
}
